/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package egovxf.dao.ibatis;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import egovxf.dao.CommonDAO;
import egovxf.dao.ExfAbstractDAO;
import egovxf.dao.IllegalClassTypeException;
import egovxf.util.ConventionUtil;

public class CommonDAOiBatisImpl  extends ExfAbstractDAO implements CommonDAO {

	static Log log = LogFactory.getLog(CommonDAOiBatisImpl.class);   
    
    public int update(String queryId, Object parameterObject) {
        return execute(queryId, parameterObject);
    }
    
    public int delete(String queryId, Object parameterObject) {
        return execute(queryId, parameterObject);
    }    
    
    public Object insert(String queryId, Object parameterObject) {
        return execute(queryId, parameterObject);
    }    
    
    public Object select(String queryId, Object parameterObject, Class clazz) {
        return executeForObject(queryId, parameterObject, clazz);
    } 
    
    public List list(String queryId, Object parameterObject) {
        return executeForObjectList(queryId, parameterObject);
    }  

    public int count(String queryId, Object parameterObject) {
        return (Integer)getSqlMapClientTemplate().queryForObject(queryId, parameterObject);
    }

    public Map<String, Object> select(String queryId, Object parameterObject) {
        return executeForMap(queryId, parameterObject);
    } 
    
    public List<Map<String, Object>> mlist(String queryId, Object parameterObject) {
        return executeForMapList(queryId, parameterObject);
    }  
    
    public int update(Object parameterObject) {
    	String queryId = ConventionUtil.getQueryId();
        return update(queryId, parameterObject);
    }
    
    public int delete(Object parameterObject) {
    	String queryId = ConventionUtil.getQueryId();
        return delete(queryId, parameterObject);
    }    
    
    public Object insert(Object parameterObject) {
    	String queryId = ConventionUtil.getQueryId();
    	String partId = ConventionUtil.getPartCd();
        return insert(queryId, parameterObject);
    }    
    
    public Object select(Object parameterObject, Class clazz) {
    	String queryId = ConventionUtil.getQueryId();
        return select(queryId, parameterObject, clazz);
    } 
    
    public List list(Object parameterObject) {
    	String queryId = ConventionUtil.getQueryId();
        return list(queryId, parameterObject);
    }  

    public int count(Object parameterObject) {
    	String queryId = ConventionUtil.getQueryId("Count");
    	return count(queryId, parameterObject);
    }

    public Map<String, Object> select(Object parameterObject) {
    	String queryId = ConventionUtil.getQueryId();
        return select(queryId, parameterObject);
    } 
    
    public List<Map<String, Object>> mlist(Object parameterObject) {
    	String queryId = ConventionUtil.getQueryId();
        return mlist(queryId, parameterObject);
    }  
}
